package com.nononsenseapps.feeder.util

import android.content.ClipData
import android.content.ClipDescription
import android.content.ClipboardManager
import android.content.Context
import android.widget.Toast
import com.gitee.wsl.common.ui.ext.toast
import es.dmoral.toasty.Toasty
import timber.log.Timber

/*fun copyFromClipboard(context: Context, callback:(String)->Unit) {
    val clipboardManager: ClipboardManager =
        context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
    if (clipboardManager.hasPrimaryClip()) {
        val clipData: ClipData? = clipboardManager.primaryClip
        val clipDescription: ClipDescription? = clipboardManager.primaryClipDescription
        clipData?.getItemAt(0)?.text.toString().let { content ->
            Timber.d("get clipboard lable:${clipDescription?.label.toString()} \tcontent:$content")
            callback(content)
        }
    }
}

fun copyToClipboard(context: Context, content:String){
        val clipboardManager: ClipboardManager =context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
        val textClip = ClipData.newPlainText("simple text", content)
        clipboardManager.setPrimaryClip(textClip)
}*/

fun Context.makeToast(text: String) {
    //Toasty.normal(this, text).show();
    toast(text)
}

/*fun Context.sucessToast(label:String){
    Toasty.success(this, label, Toast.LENGTH_SHORT, true).show();
}*/

/*
fun Context.errorToast(label:String){
    Toasty.error(this, label, Toast.LENGTH_LONG, true).show();
}*/
